import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/views/Index'
import Demo from '@/views/Demo'
import Login from '@/views/Login'
import Register from '@/views/Register'
import UserTable from '@/views/UserTable'
import CommTable from '@/views/CommTable'
import Aside from '@/views/Aside'
import Upload from '@/views/Upload'
import User from '@/views/User'
import Cart from '@/views/Cart'
import Details from '@/views/Details'
import Classify from '@/views/Classify'
import Forget from '@/views/Forget'
import Orders from '@/views/Orders'
import Buy from '@/views/Buy'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index
    }, // 主页
    {
      path: '/demo',
      name: 'Demo',
      component: Demo
    }, // 测试页面
    {
      path: '/login',
      name: 'Login',
      component: Login
    }, // 登录页面
    {
      path: '/register',
      name: 'Register',
      component: Register
    }, // 注册页面
    {
      path: '/userTable',
      name: 'UserTable',
      component: UserTable
    }, // 用户表单页面
    {
      path: '/commTable',
      name: 'CommTable',
      component: CommTable
    }, // 商品表单页面
    {
      path: '/aside',
      name: 'Aside',
      component: Aside
    }, // 侧边栏页面
    {
      path: '/upload',
      name: 'Upload',
      component: Upload
    }, // 上传图片测试页面
    {
      path: '/user',
      name: 'User',
      component: User,
      children: [
        {
          path: 'userInfo', // 用户信息
          component: () => import('../components/user/UserInfo')
        }, {
          path: 'address', // 地址管理
          component: () => import('../components/user/Address')
        }, {
          path: 'order', // 订单管理
          component: () => import('../components/user/Order')
        }, {
          path: 'updatePassword', // 修改密码管理里
          component: () => import('../components/user/UpdatePassword')
        }
      ]
    }, // 用户页面
    {
      path: '/cart',
      name: 'Cart',
      component: Cart
    }, // 购物车页面
    {
      path: '/details',
      name: 'Details',
      component: Details
    }, // 商品详情页面
    {
      path: '/classify',
      name: 'Classify',
      component: Classify
    }, // 商品分类页面
    {
      path: '/forget',
      name: 'Forget',
      component: Forget
    }, // 订单表[森亲]
    {
      path: '/orders',
      name: 'Orders',
      component: Orders
    }, // 支付表
    {
      path: '/buy',
      name: 'Buy',
      component: Buy
    } // 支付表
  ]
})
